.\"	$NetBSD: linkfarm.1,v 1.6 2009/02/08 23:11:56 wiz Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"        This product includes software developed by the NetBSD
.\"        Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\"    contributors may be used to endorse or promote products derived
.\"    from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 2, 2003
.Dt LINKFARM 1
.Os
.Sh NAME
.Nm linkfarm
.Nd manage symbolic links to package files
.Sh SYNOPSIS
.Nm
.Op Fl cDnRVv
.Op Fl d Ar stowdir
.Op Fl s Ar subdir
.Op Fl t Ar target
.Ar package
.Sh DESCRIPTION
The
.Nm
command is used to manage a "linkfarm", a directory tree of symbolic links in
.Ar target
to the files in the
.Ar package
sub-directory of
.Ar stowdir .
The default action is to create a linkfarm to a package.
.Pp
The following command-line options are supported:
.Bl -tag -width indent
.It Fl c
Check whether a package contains a linkfarm in
.Ar target .
If
.Ar package
has no symbolic links in
.Ar target
that correspond to its files, then return 0, otherwise return 1.
.It Fl D
Delete the linkfarm for
.Ar package .
.It Fl d Ar stowdir
Set
.Ar stowdir
as the directory in which
.Ar package
can be found.
The default
.Ar stowdir
is the
.Pa packages
sub-directory in the default
.Ar target
directory.
.It Fl n
Don't actually execute the commands for removing and creating the symbolic
links and directories.
.It Fl R
Delete and re-create the linkfarm for
.Ar package .
.It Fl s Ar subdir
The root of the package hierarchy for the linkfarm is the
.Ar subdir
sub-directory in the package.
By default, assume the root of the package hierarchy is simply the
.Ar package
directory.
.It Fl t Ar target
Set
.Ar target
as the directory in which to create and delete the linkfarm for
.Ar package .
The default
.Ar target
directory is
.Pa /usr/pkg
but may be overridden by the
.Ev LOCALBASE
environment variable.
.It Fl V
Print version number and exit.
.It Fl v
Turn on verbose output.
Specifying
.Fl v
multiple times increases the level of verbosity.
.El
.Sh ENVIRONMENT
.Bl -tag -width indent
.It Ev LOCALBASE
The standard packages directory,
.Pa /usr/pkg ,
can be overridden by specifying an alternative directory in the
.Ev LOCALBASE
environment variable.
This affects the default
.Ar target
and
.Ar stowdir
directories.
.It Ev PLIST_IGNORE_FILES
This can be used to specify files in
.Ar package
that should ignored when creating and deleting symbolic links in
.Ar target .
.Ev PLIST_IGNORE_FILES
is a space-separated list of shell glob patterns that match files relative
to the
.Ar package
directory, and it defaults to "info/dir *[~#] *.OLD *.orig *,v".
.El
.Sh SEE ALSO
.Xr lndir 1 ,
.Xr pkg_view 1
.Sh AUTHORS
The
.Nm
utility was written by
.An Alistair G. Crooks Aq agc@NetBSD.org .
